package org.xshop.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.xshop.mapper.TGoodsTypeAttributeMapper;
import org.xshop.model.TGoodsTypeAttribute;
import org.xshop.service.ITGoodsTypeAttributeService;

import com.weibo.api.motan.config.springsupport.annotation.MotanService;

import top.ibase4j.core.base.BaseServiceImpl;
import top.ibase4j.core.support.Pagination;

/**
 * <p>
 * 商品类型属性 服务类
 * </p>
 *
 * @author ShenHuaJie
 * @since 2017-03-19
 */
@MotanService(interfaceClass = ITGoodsTypeAttributeService.class)
@CacheConfig(cacheNames = "goodsTypeAttribute")
public class GoodsTypeAttributeService extends BaseServiceImpl<TGoodsTypeAttribute, TGoodsTypeAttributeMapper>
implements ITGoodsTypeAttributeService {
    @Autowired
    private SysService sysService;

    @Override
    public Pagination<TGoodsTypeAttribute> query(Map<String, Object> params) {
        Pagination<TGoodsTypeAttribute> page = super.query(params);
        Map<?, ?> dicMap = sysService.getDic("GOODSTYPE");
        for (TGoodsTypeAttribute record : page.getRecords()) {
            record.setGoodsTypeName((String)dicMap.get(record.getGoodsType()));
        }
        return page;
    }
}
